find_path(OSG_INCLUDE_DIR osg/Node
  "{INCLUDE}"
  "{LIB_DIR}/include"
)

macro(find_osg_library)
  foreach(_var ${ARGN})
    string(TOUPPER ${_var} varU)
    find_library(${varU}_LIBRARY NAMES ${_var} PATHS
      "{LIB}"
      "{LIB_DIR}/lib"
      "{LIB_DIR}/lib64"
    )
    if(${varU}_LIBRARY)
      list(APPEND ALL_OSG_LIBRARY ${${varU}_LIBRARY})
    endif()
  endforeach()
endmacro()

find_osg_library(
  OpenThreads
  osg
  osgText
  osgPresentation
  osgUtil
  osgParticle
  osgViewer
  osgSim
  osgWidget
  osgVolume
  osgDB
  osgFX
  osgAnimation
  osgUI
  osgManipulator
  osgTerrain
  osgShadow
  osgGA
  osgEarth
  osgEarthSplat
  osgEarthAnnotation
  osgEarthSymbology
  osgEarthUtil
  osgEarthFeatures
)

#message("----------:${ALL_OSG_LIBRARY}")
if (OSG_INCLUDE_DIR AND ALL_OSG_LIBRARY)
  set(OSG_FOUND TRUE)
endif()
